package com.yupi.springbootinit.exception;

import com.yupi.springbootinit.common.ErrorCodeXzh;

/**
 * 自定义异常类
 */
public class BusinessExceptionXzh extends RuntimeException{
    /**
     * 错误码
     */
    private int code;

    public BusinessExceptionXzh(int code , String message){
        super(message);
        this.code=code;
    }

    public BusinessExceptionXzh(ErrorCodeXzh errorCodeXzh){
        super(errorCodeXzh.getMessage());
        this.code=errorCodeXzh.getCode();
    }

    public BusinessExceptionXzh(ErrorCodeXzh errorCodeXzh, String message){
        super(message);
        this.code=errorCodeXzh.getCode();
    }

    public int getCode(){
        return code;
    }
}
